<?xml version='1.0' encoding='UTF-8'?>

<!DOCTYPE root PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:a4j="http://richfaces.org/a4j"
	xmlns:rich="http://richfaces.org/rich">

	<div class="innerTitle">Lista de Pontos (<h:outputText value="total:#{pontoBean.entitiesSize}"/>)</div>

	<h:panelGroup styleClass="innerFilter" layout="block">

		<div class="innerTextFilter">Filtro</div>

		<h:inputText value="#{pontoBean.filter}"></h:inputText>

		<h:commandButton value="Pesquisar" action="#{pontoBean.search}" styleClass="button"/>

		<a4j:commandButton value="Importar" action="#{pontoBean.prepareSaveImportarPonto}" styleClass="button" reRender="popup"/>

		<h:commandButton value="Novo" action="#{pontoBean.prepareSave}" styleClass="button"/>

		<h:commandButton image="/images/icons/google-earth.png" action="#{pontoBean.showPointsGoogleEarthFile}" styleClass="button"  style="height: 16px; width: 16px"/>

		<rich:dataTable id="listaPonto" rowClasses="even,odd" value="#{pontoBean.entities}" var="ponto" rows="10">

			<rich:column sortBy="#{ponto.nome}">
				<f:facet name="header"><h:outputLabel value="Nome"/></f:facet>
				<h:outputText value="#{ponto.nome}"/>
			</rich:column>

			<rich:column sortBy="#{ponto.nome}">
				<f:facet name="header"><h:outputLabel value="Cod Ponto Cliente"/></f:facet>
				<h:outputText value="#{ponto.codigoPonto}"/>
			</rich:column>

			<h:column rendered="#{controlBean.administradorSistema}">
				<f:facet name="header"><h:outputLabel value="Cliente"/></f:facet>
				<h:outputText value="#{ponto.cliente.nome}"/>
			</h:column>

			<h:column headerClass="link">
				<h:commandLink action="#{pontoBean.prepareUpdate}">
					<h:graphicImage styleClass="link" alt="Alterar" url="/images/btn/update.png"/>
					<f:setPropertyActionListener target="#{pontoBean.entity}" value="#{ponto}"/>
				</h:commandLink>
			</h:column>

			<h:column headerClass="link">
				<a4j:commandLink action="#{pontoBean.delete}" reRender="popup">
					<h:graphicImage styleClass="link" alt="Excluir" url="/images/btn/delete.png"/>
					<f:setPropertyActionListener target="#{pontoBean.entity}" value="#{ponto}"/>
				</a4j:commandLink>
			</h:column>

            <f:facet name="footer">
				<rich:datascroller renderIfSinglePage="false" reRender="listaPonto" />
            </f:facet>

		</rich:dataTable>

	</h:panelGroup>

</ui:composition>